From b122787a76977aa050a4e12bcf397e5dbbfe8a20 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 7 May 2015 18:28:39 -0400 Subject: [PATCH] GtkFontChooser: Use a GtkStack --- gtk/gtkfontchooserwidget.c | 10 +++++----- gtk/ui/gtkfontchooserwidget.ui | 15 ++++++--------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c index 5723687874..526823ce73 100644 --- a/gtk/gtkfontchooserwidget.c +++ b/gtk/gtkfontchooserwidget.c @@ -37,7 +37,7 @@ #include "gtkintl.h" #include "gtklabel.h" #include "gtkliststore.h" -#include "gtknotebook.h" +#include "gtkstack.h" #include "gtkprivate.h" #include "gtkscale.h" #include "gtkscrolledwindow.h" @@ -79,7 +79,7 @@ struct _GtkFontChooserWidgetPrivate GtkTreeViewColumn *family_face_column; GtkCellRenderer *family_face_cell; GtkWidget *list_scrolled_window; - GtkWidget *list_notebook; + GtkWidget *list_stack; GtkTreeModel *model; GtkTreeModel *filter_model; @@ -512,7 +512,7 @@ row_inserted_cb (GtkTreeModel *model, GtkFontChooserWidget *fontchooser = user_data; GtkFontChooserWidgetPrivate *priv = fontchooser->priv; - gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->list_notebook), 0); + gtk_stack_set_visible_child_name (GTK_STACK (priv->list_stack), "list"); } static void @@ -524,7 +524,7 @@ row_deleted_cb (GtkTreeModel *model, GtkFontChooserWidgetPrivate *priv = fontchooser->priv; if (gtk_tree_model_iter_n_children (model, NULL) == 0) - gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->list_notebook), 1); + gtk_stack_set_visible_child_name (GTK_STACK (priv->list_stack), "empty"); } static void @@ -551,7 +551,7 @@ gtk_font_chooser_widget_class_init (GtkFontChooserWidgetClass *klass) gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, family_face_column); gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, family_face_cell); gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, list_scrolled_window); - gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, list_notebook); + gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, list_stack); gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, model); gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, filter_model); gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, preview); diff --git a/gtk/ui/gtkfontchooserwidget.ui b/gtk/ui/gtkfontchooserwidget.ui index 2d5ec444b4..77590c1ad5 100644 --- a/gtk/ui/gtkfontchooserwidget.ui +++ b/gtk/ui/gtkfontchooserwidget.ui @@ -57,10 +57,8 @@ - + True - True - False 400 @@ -99,11 +97,12 @@ - - + + list + - + True center start @@ -114,11 +113,9 @@ No fonts matched your search. You can revise your search and try again. - 1 + empty - - 0 -- 2.30.2